getNowUser();

function update() {
	$.ajax({
		url : 'user/updateUserInfo',
		type : "POST",
		data : {
			newUserName : $("#userName").val(),
			gender : $("#sex").val(),
			description : $("#userDesc").val(),
		},
		success : function(data) {
			switch (data['status']) {
			case -250:
				window.location.href = "login.html";
				break;
			case 0:
				window.location.href = "edit_self.html";
			default:
                alert(data['msg']);
                break;
			}
		},
		error : function(err) {
			console.log(err);
		}
	});
}

function getNowUser() {
	$.ajax({
		url : 'user/getNowUser',
		type : "GET",
		data : {},
		success : function(data) {
			switch (data['status']) {
			case 0:
				$("#userName").val(data['result']['nowUser']['userName']);
				$("#userDesc").val(data['result']['nowUser']['description']);
				$("#sex").val(data['result']['nowUser']['gender']);
				$("#dataPor").attr("src", data['result']['nowUser']['headImg'])
				break;
			default:
				alert(data['msg']);
				break;
			}
		},
		error : function(err) {
			console.log(err);
		}
	});
}
